import setting
import pymysql

def init_db():
    coon = pymysql.connect(
        host = setting.DATABASE["hostname"],
        port = setting.DATABASE["port"],
        user = setting.DATABASE["username"],
        passwd = setting.DATABASE["password"],
        db = setting.DATABASE["database"],
        charset = setting.DATABASE["charset"]
    )
    return coon

if __name__ == "__main__":
    coon = init_db()
    cur = coon.cursor()
    a = cur.execute("show databases;")
    print(a)